<%@ page language="java"  pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/views/common/taglib.jsp" %>
<html>
<head>
    <title>物料价格列表</title>
    <%@ include file="/WEB-INF/views/common/resource.jsp" %>
    <link href="${rtx}/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="${rtx}/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="${rtx}/css/upload_style.css"/>
    <script>
        var cityAreaList = '${cityAreaListJson}';
    </script>
</head>
<body>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="form-group">

            <label class="col-sm-1 control-label">物料编号</label>
            <div class="col-sm-2">
                <div class="row">
                    <input type="text" id="goods_no" placeholder="请输入物料编号" class="form-control">
                </div>
            </div>

            <label class="col-sm-1">城市</label>
            <div class="col-sm-2">
                <select class="form-control m-b" name="status" id="sale_city" onchange="chooseCity()"  >
                    <option value="">全部</option>
                    <c:forEach items="${cityAreaList}" var="list">
                        <option value="${list.area_no}">${list.area_name}</option>
                    </c:forEach>
                </select>
            </div>

            <label class="col-sm-1">区域</label>
            <div class="col-sm-2">
                <select class="form-control m-b" name="status" id="sale_area">
                    <option value="">全部</option>
                    <c:forEach items="${cityAreaList}" var="list">
                        <c:forEach items="${list.areaList}" var="list2">
                            <option value="${list2.area_no}">${list2.area_name}</option>
                        </c:forEach>
                    </c:forEach>
                </select>
            </div>

            <label class="col-sm-1">渠道</label>
            <div class="col-sm-2">
                <select class="form-control m-b" name="status" id="sale_channel">
                    <option value="">全部</option>
                    <c:forEach items="${channelList}" var="list">
                        <option value="${list.d_no}">${list.name}</option>
                    </c:forEach>
                </select>
            </div>

        </div>
    </div>

    <div class="row">
        <div class="form-group">
            <label class="col-sm-1 control-label">状态</label>
            <div class="col-sm-2">
                <select class="form-control m-b" id="check_status">
                    <option value="-2">全部</option>
                    <option value="1">已生效</option>
                    <option value="2">已停用</option>
                    <option value="3">未生效</option>
                    <option value="4">已失效</option>
                </select>
            </div>
            <div class="col-sm-2 ">
                <button onclick="search()" style="width: 100px;" class="btn btn-primary" type="button">搜索</button>
            </div>

            <div class="col-sm-2 ">
                <button onclick="showImportTable()" style="width: 107px;" class="btn btn-primary" type="button">导入物料价格</button>
                <a data-toggle="modal" style="display: none" id="showImportTable" class="btn btn-primary" href="#upload-form"></a>
            </div>

            <div class="col-sm-2 ">
                <button onclick="window.location.href='${ctx}/goods/getExportGoodsPriceInfo.do'" style="width: 107px;" class="btn btn-primary" type="button">导出物料价格</button>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="form-group">
        </div>
    </div>

    <div class="ibox-content">
        <div class="row ">
            <div class="col-sm-12">
                <table id="table" ></table>
            </div>
        </div>
    </div>
</div>

<div id="upload-form" class="modal fade" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-12">
                        <input type="hidden" id="upload_file_url">
                        <h3 class="m-t-none m-b">导入物料价格信息</h3>

                        <div id="container" class="form-group" style="text-align: center">
                            <label>上传文件：</label>
                            <a id="self" class="btn btn-primary" href="javascript:void(0);" >选择文件</a>
                            <span id="upload_file_name"></span>
                        </div>

                        <!--图片上传进度条-->
                        <div id="uploading" class="shareBox" style="z-index: 1000; margin-left: 31%">
                            <div class="uploading_bar" id="ossfile" style="z-index: 1000;"></div>
                        </div>

                        <div style="text-align: center">
                            <button class="btn btn-sm btn-primary" onclick="importGoodsPrice()"><strong>确定导入</strong>
                            </button>
                            <a style="display: none" data-toggle="modal" id="loading" class="btn btn-sm btn-primary" href="#import-loading"></a>
                            <button class="btn btn-sm" onclick="$('#upload-form').click()"><strong>取消导入</strong>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="import-loading" disabled="disabled" class="modal fade" aria-hidden="true">
    <div style="background: #777 ;height: 100% ;opacity:0.1" >
    </div>
    <div class="ibox-content" style="background: none;border-color: #777;position: fixed;margin-top: -40%;margin-left:45%; border-width: 0 0;">
        <h3 style="color: white">正在处理中...</h3>
        <div class="spiner-example">
            <div class="sk-spinner sk-spinner-three-bounce">
                <div class="sk-bounce1"></div>
                <div class="sk-bounce2"></div>
                <div class="sk-bounce3"></div>
            </div>
        </div>
    </div>
</div>


<div id="modal-form" class="modal fade" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-12">
                        <input id="edit_config_id" type="hidden" class="form-control">
                        <h3 class="m-t-none m-b">修改物料价格</h3>
                        <div class="form-group">
                            <label>物料编号：</label>
                            <label id="show_goods_no"></label>
                        </div>

                        <div class="form-group">
                            <label>城市：</label>
                            <label id="show_sale_goods_city"></label>
                        </div>

                        <div class="form-group">
                            <label>区域：</label>
                            <label id="show_sale_goods_area"></label>
                        </div>

                        <div class="form-group">
                            <label>渠道：</label>
                            <label id="show_sale_channel"></label>
                        </div>

                        <div class="form-group">
                            <label>有效开始时间：</label>
                            <label id="show_start_time"></label>
                        </div>

                        <div class="form-group">
                            <label>有效结束时间：</label>
                            <label id="show_end_time"></label>
                        </div>

                        <div class="form-group">
                            <label>价格：（单位：元）</label>
                            <input id="edit_goods_price" type="text"  class="form-control" onkeyup="this.value=(this.value.match(/\d+(\.\d{0,2})?/)||[''])[0]">
                        </div>

                        <div style="text-align: center">
                            <button class="btn btn-sm btn-primary" onclick="saveGoodsPrice()"><strong>保存编辑</strong>
                            </button>

                            <button class="btn btn-sm" onclick="$('#modal-form').click()"><strong>取消编辑</strong>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script language="javascript" type="text/javascript" src="${rtx}/js/goods/goods_price_manager.js"></script>
<script language="javascript" type="text/javascript" src="${rtx}/js/plupload-2.1.2/js/plupload.full.min.js"></script>
<script language="javascript" type="text/javascript" src="${rtx}/js/upload.js"></script>
<script src="${rtx}/js/plugins/datapicker/bootstrap-datepicker.js"></script>
<script src="${rtx}/js/plugins/clockpicker/clockpicker.js"></script>
<script src="${rtx}/js/plugins/cropper/cropper.min.js"></script>
</html>
